4000 CLS:COLOR 7,1,0: PRINT "CALCULATING SUMS AND SUMS OF SQUARES"
4010 PRINT "PLEASE HAVE PATIENCE: THIS WILL TAKE SOME TIME!"
4020 GOTO 20000
4040 CLS:COLOR 7,1,0:IF X$(1)="END" OR Y$(1)="END" THEN PRINT "NO DATA ENTERED, CAN'T SHOW COEFFICIENTS!": PRINT CHR$(7): FOR I=1 TO 1000: NEXT I: GOTO 120
4501 INPUT "Output coefficients to printer (Y or N)";Q1$
4502 CLS:COLOR 7,1,0:GOSUB 50000
4503 A4$="EQ# COEF A COEF B COEF C R^2 R^2 C EQUATION"
4505 INPUT"Print A, B, and R^2 to SCREEN (ALL DIGITS) First? {Y}es or {N}o ";A$:IF LEFT$(A$,1)="Y" OR LEFT$(A$,1)="y" THEN 35000
4507 CLS:COLOR 7,1,0:INPUT"View Coefficients (A, B, C, R^2, Corr R^2, Eqn) on Screen (Y)es or (N)o ";A$:IF LEFT$(A$,1)="N" OR LEFT$(A$,1)="n" THEN 4572
4510 CLS:COLOR 7,1,0:PRINT A4$
4515 LC=0
4520 FOR I= 1 TO 22
4521 IF A(I)=0 AND B(I)=0 THEN 4532
4530 PRINT USING A1$;I;:PRINT" ";:PRINT USING A2$;A(I);:PRINT" ";:PRINT USING A2$;B(I);:PRINT" ";:PRINT USING A2$;C(I);:PRINT" ";:PRINT USING A3$;RR(I);:PRINT USING A0$;RC(I);:PRINT" ";:PRINT EQ$(I):LC=LC+1
4532 NEXT I
4535 IF LP=1 THEN 4560
4536 IF LC<=19 THEN 4560
4540 INPUT "Press <Enter> for the remaining coefficients. ";A$
4550 PRINT A4$
4560 FOR I= 23 TO 25
4561 IF A(I)=0 AND B(I)=0 THEN 4571
4570 PRINT USING A1$;I;:PRINT" ";:PRINT USING A2$;A(I);:PRINT" ";:PRINT USING A2$;B(I);:PRINT" ";:PRINT USING A2$;C(I);:PRINT" ";:PRINT USING A3$;RR(I);:PRINT USING A0$;RC(I);:PRINT" ";:PRINT EQ$(I)
4571 NEXT I
4572 IF LP<>1 THEN 4580
4573 IF LP=1 THEN LPRINT A4$
4574 FOR I=1 TO 25
4575 IF A(I)=0 AND B(I)=0 THEN 4578
4576 IF LP=1 THEN LPRINT USING A1$;I;:LPRINT" ";:LPRINT USING A2$;A(I);:LPRINT" ";:LPRINT USING A2$;B(I);:LPRINT" ";:LPRINT USING A2$;C(I);:LPRINT" ";:LPRINT USING A3$;RR(I);:LPRINT USING A0$;RC(I);:LPRINT" ";:LPRINT EQ$(I)
4578 NEXT I
4580 R2=1: GOSUB 4220
4600 PRINT "Based on the value of RC(), the best fit was # ";MQ
4605 IF LP=1 THEN LPRINT"BASED ON THE VALUE OF RC( )--BEST FITTING CURVE WAS NUMBER";MQ
4610 INPUT "PRESS <ENTER> to return to MAIN MENU";A$
4620 IF LP=1 THEN LPRINT CHR$(12)
4630 GOTO 120
4990 PRINT CL$: AZ$=""
5000 K=0:L=0:IF AZ$="S" THEN INPUT "All data entered, press <Enter> to continue";A$
5002 CLS:COLOR 7,1,0: PRINT "Predicted value of Y, given X":K=1
5003 INPUT "Quit and return to main menu or Predict (Q or P)";AZ$
5004 PRINT CL$:IF L=1 AND LP=1 THEN LPRINT CHR$(12)
5005 IF LEFT$(AZ$,1)="q" OR LEFT$(AZ$,1)="Q" THEN 120
5006 INPUT "Output results to printer (Y or N) ";Q1$
5007 GOSUB 50000
5010 INPUT "Starting value for X";SX
5020 INPUT "Ending value for X";EX
5030 INPUT "Step value for X";ST
5040 INPUT "Equation number for prediction (1-25)";EQ
5050 IF EQ<1 OR EQ>25 GOTO 120
5051 IF A(EQ)=0 AND B(EQ)=0 THEN PRINT"THE EQUATION ";EQ$(EQ);" IS NOT DEFINED FOR THIS DATA SET.":PRINT"RETURNING TO MAIN MENU":FOR M=1 TO 2000:NEXT M:GOTO 120
5052 PRINT "PREDICTIONS ARE FOR EQUATION ";TAB(40);EQ$(EQ)
5053 IF LP=1 THEN LPRINT"PREDICTIONS FOR EQUATION ";EQ$(EQ):LPRINT" "